import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { BusiProvider } from '../../providers/busi/busi';
import { NativeProvider } from '../../providers/native/native';

/**
 * Generated class for the ShopaddPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-shopadd',
  templateUrl: 'shopadd.html',
})
export class ShopaddPage {
  shop_name;
  shop_addr;
  shop_desc;
  constructor(public navCtrl: NavController, public navParams: NavParams,public busi:BusiProvider,public native:NativeProvider) {

  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad ShopaddPage');
  }
  save(){
    const body = {
      shop_name:this.shop_name,
      shop_addr:this.shop_addr,
      shop_desc:this.shop_desc,
    }
    this.busi.shopAdd(body).subscribe(
      data=>{
        this.native.showToast("申请提交成功");
        this.navCtrl.pop();
      },
      err=>{

      }
    )
  }

}
